from django import forms
from django.contrib.auth.forms import UserCreationForm

from customauth.models import MyUser


class DateInput(forms.DateInput):
    input_type = "date"
    format = "%d.%m.%Y"
    attrs = {  # noqa: RUF012
        "class": "form-control",
        "placeholder": "Select a date",
        "type": "date",  # <--- IF I REMOVE THIS LINE, THE INITIAL VALUE IS DISPLAYED
    }


# Float field
class FloatInput(forms.NumberInput):
    input_type = "number"
    attrs = {  # noqa: RUF012
        "class": "form-control",
        "placeholder": "Enter a number",
        "type": "number",
        "step": "0.01",
    }


class TextInput(forms.TextInput):
    input_type = "text"
    attrs = {
        "class": "form-control",
        "placeholder": "Введите текст",
        "style": "width: 100%",
    }


class SignUpForm(UserCreationForm):
    class Meta:
        model = MyUser
        exclude = (
            "id",
            "is_active",
            "is_staff",
            "is_admin",
            "is_superuser",
            "last_login",
            "date_joined",
            "groups",
            "user_permissions",
            "id_password",
        )
        #     "username",
        #     "password1",
        #     "password2",
